import { ChildAppMenu } from "@/models/menu";

export class ChildAppRoute extends ChildAppMenu {
  //子应用路由
  title = ""; //标题
  defaultPath?: string; //默认跳转使用路径 （部分路由path是具有匹配规则的）
  isChildAppRoute = true //是否是子应用
  activeMenu = false; //是否是强制当前路由
  hidden = false; //是否在slidBar 菜单隐藏此路由
}
export class RouteMeta {
  title = ""; //标题影响 显示浏览器窗口tab名 影响显示面包屑导航名字 及菜单名
  name?: string; //名字
  icon?: string; //svg文字图标影响菜单栏图标显示
  defaultPath?: string; //默认跳转使用路径 （部分路由path是具有匹配规则的）
  menuKey = ""; //slidBar菜单key值
  parentKeys: string[] = []; //父菜单key值数组
  breadcrumb = true; //该路由是否作用于面包屑导航 作为一员
  isBreadcrumbJump = true; //该路由面包屑导航是否跳转
  activeMenu = false; //是否是强制当前路由
  hidden = false; //是否在slidBar 菜单隐藏此路由
  childAppRoutes?: Array<ChildAppRoute>; //子应用路由数组
  constructor(params: Partial<RouteMeta>) {
    if (params.title != undefined) this.title = params.title;
    if (params.name != undefined) this.name = params.name;
    if (params.icon != undefined) this.icon = params.icon;
    if (params.defaultPath != undefined) this.defaultPath = params.defaultPath;
    if (params.menuKey != undefined) this.menuKey = params.menuKey;
    if (params.parentKeys != undefined) this.parentKeys = params.parentKeys;
    if (params.breadcrumb != undefined) this.breadcrumb = params.breadcrumb;
    if (params.isBreadcrumbJump != undefined)
      this.isBreadcrumbJump = params.isBreadcrumbJump;
    if (params.activeMenu != undefined) this.activeMenu = params.activeMenu;
    if (params.hidden != undefined) this.hidden = params.hidden;
    if (params.childAppRoutes != undefined)
      this.childAppRoutes = params.childAppRoutes;
  }
}
